
 var pageBody = $("#main-box").children(".show");
 var card = $(".toPage-card",pageBody);
 console.log(pageBody)
 var toPageUrl =pageBody.attr("id");
 console.log(toPageUrl)

 window.addEventListener('load', function(e) {
     console.log("111111111");
     }, true);

 for (var i = 0; i < card.length; i++) {
     console.log(i)
     bindPageCard(i,toPageUrl,pageBody)
 }

 //绑定
 function bindPageCard(num,url,page) {
     console.log(page.attr("id"))
     $(card[num]).click(function () {
         page.empty();
         console.log(page)
         // console.log('/management/toPage?url='+toPageUrl+'&companyId='+$(this).children().children().get(0).innerText);
         page.load('/management/toPage?url=/'+url+'&companyId='+$(this).children().children().get(0).innerText);
     });
 }

 //打开批量管理页面
 function batchOperation() {
     var pageBox = $("#main-box").children(".show");
     var url = pageBox.attr("id");
     var mainbox = document.getElementById("batch_"+url);
     var lable = document.getElementById("batch_"+url + "-lable");
     if (lable == null) {
         mainbox = document.getElementById(url);
         lable = document.getElementById(url + "-lable");
         var lableChild = $(lable).children().children().children();
         console.log(lable)
         console.log("批量操作地址："+"/"+url+"/batch");
         pageBody.load("/"+url+"/batch",function(response,status,xhr){
             if (status == "error") {
                 alert("此功能不存在！")
                 return;
             }
             $(mainbox).attr("id","batch_"+url);
             $(lable).attr("id","batch_" + url + "-lable");
             lableChild.get(1).id += "_batch";
             lableChild.get(0).innerText += ":批量";
         });
         return;
     }
     lable.click();
 }
